from common.arguments import get_common_args
from common.agent import Agent
from common.runner import Runner
import gym


def main():
    args = get_common_args()

    # init the env
    env_name = 'CartPole-v1'
    # env_name = 'MountainCar-v0'
    env = gym.make(env_name)
    state_size = env.observation_space.shape[0]
    action_size = env.action_space.n

    # env_name = 'Pendulum-v1'
    # env = gym.make(env_name)
    # state_size = env.observation_space.shape[0]
    # action_size = env.action_space.shape[0]
    # action_bound = env.action_space.high[0]
    # print("action_bound = ", action_bound)

    #init the agent
    algo = "DQN"
    agent = Agent(algo, state_size, action_size, args)

    #init the runner
    runner = Runner(env, agent, args, env_name)
    runner.run()

if __name__ == '__main__':

    main()
